package com.laibatour.generator.gen;

import com.laibatour.generator.entity.Table;
import com.laibatour.generator.utils.PropertieUtils;

import java.io.File;

public abstract class BaseOutput {

    Table config;

    // 绝对路径前缀
    protected String rootPath;

    public BaseOutput(Table config) {
        this.config = config;
        this.rootPath = PropertieUtils.getProperty("product_path");
    }

    protected abstract String getRelativePath();

    protected abstract String getFileName();

    public String getOutput() {
        String filePath = rootPath + "/" + getRelativePath();
        File file = new File(filePath);
        if (!file.exists()) {
            file.mkdirs();
        }
        return filePath + "/" + getFileName();
    }

    public abstract String getVM();
}
